package faircat.android.exphone;

import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothSocket;
import java.lang.reflect.Method;
import java.io.IOException;
import java.lang.NoSuchMethodException;
import java.lang.reflect.InvocationTargetException;

import android.util.Log;

public class BluetoothSocketProxy {
	BluetoothSocket mSocket;
	
	public BluetoothSocketProxy(String address, int port){
		try{
			mSocket = BluetoothSocketFactory.createBluetoothSocket(
				BluetoothSocketFactory.TYPE_L2CAP, -1, false, 
				false, address, port);
		}
		catch(IOException e){
			Log.e("BluetoothSocketProxy", "constructory", e);
		}		
		catch(Exception e){
			Log.e("BluetoothSocketProxy", "constructory", e);
		}
	}
	/*
	public BluetoothSocketProxy(BluetoothSocketJNI socket){
		mSocket = socket;
	}
	
	public void listen() throws IOException{
		mSocket.bindListen();
	}
	
	public void connect() throws IOException{
		mSocket.connect();
	}
	
	public void close() throws IOException{
		mSocket.close();
	}
	
	public BluetoothSocketProxy accept(int timeout) throws IOException{
		return new BluetoothSocketProxy(mSocket.accept(timeout));
	}
	
	public int read(byte[] b, int offset, int length) throws IOException{
		return mSocket.read(b,  offset, length);
	}
	
	public int write(byte[] b, int offset, int length) throws IOException{
		return mSocket.write(b,  offset, length);
	}
	//*/
}
